<div class="panel panel-default" style="border-top: none">
  <ul class="list-group">
    <li class="list-group-item" ng-repeat="user in users">
      <strong>代码：</strong>{{user.code}}
      <strong>姓名：</strong>{{user.name}}
      <span class="text-muted" ng-show="user.chargeklass">---{{user.chargeklass}}班级--班主任</span>
      <br>
      <span class="text-muted" ng-show="user.courses.length>0">{{user.courses}}</span>
      <span class="text-muted" ng-show="user.klasses.length>0">{{user.klasses}}</span>

      <a ng-click="delete(user)" class="trash" data-toggle="tooltip" title="删除信息！" href="#">
        <span class="glyphicon glyphicon-trash pull-right"  style="margin-left:30px;currsor:point"></span>
      </a>
      <a ng-click="edit(user)" class="edit" data-toggle="tooltip" title="编辑信息" href="#">
        <span class="glyphicon glyphicon-edit pull-right"  style="margin-left:30px"></span>
      </a>
    </li>
  </ul>
</div>
<div class="panel panel-default">
  <div class="panel-heading">新增与编辑</div>
  <br>
  <form class="form-inline" name="form" ng-submit="save(form)" novalidate>
    <div class="form-group">
      <label for="inputCode">教师代码:</label>
      <input type="text" class="form-control" id="inputCode" name="code" ng-model="code" placeholder="用户代码" ng-change="form.code.$setValidity('mongoose', true);" required>
    </div>
    <div class="form-group">
      <label for="inputName">教师姓名:</label>
      <input type="text" class="form-control" id="inputName" name="name" ng-model="name" placeholder="用户姓名" required>
    </div>
    <div class="form-group">
      <label class="checkbox-inline">
        <input type="checkbox" ng-model="isHeadTeacher">班主任
      </label>
    </div>
    <hr>
    <span>所授课程:</span>
    <div class="form-group">
      <label class="checkbox-inline" ng-repeat="course in courses">
        <input type="checkbox" ng-model="course.checked"> {{course.name}}
      </label>
    </div>
    <br>
    <br>
    <span>所教班级:</span>
    <div class="form-group">
      <label class="checkbox-inline" ng-repeat="klass in klasses">
        <input type="checkbox" ng-model="klass.checked"> {{klass.name}}
      </label>
    </div>

    <span ng-show="isHeadTeacher"><br><br>任班主任班级:</span>
    <div class="form-group" ng-show="isHeadTeacher">
      <label class="checkbox-inline" ng-repeat="klass in klasses">
        <input type="radio" name="chargeklass" ng-model="$parent.chargeklass" value="{{klass.code}}">{{klass.name}}
      </label>
    </div>
    <hr>
    <div class="form-group has-error">
      <p class="help-block" ng-show="(form.code.$error.required || form.name.$error.required) && submitted">
        用户代码和姓名不能为空.
      </p>
      <p class="help-block" ng-show="form.code.$error.mongoose">
        {{ errors.code }}
      </p>
      <p class="help-block">{{ errors.other }}</p>
    </div><br>
    <div class="form-group">
      <label class="checkbox-inline">
        <input type="checkbox" ng-model="setpass"> 设置密码
      </label>
      <input type="password" ng-show="setpass" class="form-control" id="inputPassword1" ng-model="password" placeholder="Password">
      <button type="submit" class="btn btn-primary" style="margin-left:100px">提交保存</button><a  class="btn btn-danger btn-sm" ng-click="reset()" style="margin-left:60px">内容重置，重新录入</a>
    </div>

  </form>
</div>
